use strict;
my @buffer = ('', '');

# <g id="edge426" class="edge"><title>348657&#45;&gt;DEV_EX_FIXX2_0912_BRANCH</title>
# <a xlink:title="trunk@348657&#45;&gt;DEV_EX_FIXX2_0912_BRANCH">
while (my $line = <>) {
    push @buffer, $line;
    $line = shift @buffer;
    print $line;
    if ($buffer[1] =~ /^<a xlink:title="(.+)">\n$/s) {
        my $title = $1;
        $buffer[0] =~ s{<title>.+</title>\n$}{<title>$title</title>\n}s;
    }
}

for (@buffer) {
    print $_;
}
